package com.wlyuan.open.scanner.dao.mapper;

import com.wlyuan.open.scanner.dao.entity.OrderSignLogDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单签收记录 Mapper 接口
 * </p>
 *
 * @author yuanjie
 * @since 2022-10-27
 */
public interface OrderSignLogMapper extends BaseMapper<OrderSignLogDO> {


    /**
     * 查询订单签收记录
     * @param orderIds
     * @return
     */
    @Select("<script>" +
            "select root_order_id as rootOrderId, cert_url as certUrl from order_sign_log where EXISTS (select Index_RootOrderID from " +
            "    TMS_OrderIndex where Index_ID in " +
            "    <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'> " +
            "      #{item} " +
            "    </foreach> " +
            "    and Index_RootOrderID = root_order_id)" +
            "</script>")
    List<OrderSignLogDO> getCertUrlByOrderIds(List<Long> orderIds);

}
